using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //定义数组
            int[][] line = new int[20][];
            //声明数组
            for (int i = 0; i < line.Length; i++) {
                line[i] = new int[i + 1];
            }
            //各咧元素的初始化
            for (int i = 0; i < line.Length; i++) {
                line[i][0] = 1;
                line[i][(line[i].Length)-1] = 1;
            }
            //核心计算方法
            for (int i = 2; i < line.Length; i++)
            {
                for (int j = 1; j < line[i].Length - 1; j++)
                {
                    line[i][j] = line[i - 1][j] + line[i - 1][j - 1];
                }
            }
            //遍历显示所有内容
            for (int i = 0; i < line.Length; i++)
            {
                for (int j = 0; j < line[i].Length; j++)
                {
                    Console.Write(line[i][j]+"\t");
                }
                Console.Write("\n");
            }
            
            Console.Read();
        }
    }
}
